package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.domain.Book;
import com.itheima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.management.openmbean.CompositeDataSupport;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;
    //查询全部
    @Override
    public List<Book> findAllBooks() {
        return bookDao.findAllBooks();
    }
    //查询id
    @Override
    public Book findById(Integer id) {
        return bookDao.findById(id);
    }
    //增加
    @Override
    public boolean saveBooks(Book book) {
        bookDao.saveBooks(book);
        return true;
    }
    //修改
    @Override
    public boolean updateBooks(Book book) {
        bookDao.updateBooks(book);
        return true;
    }
    //删除
    @Override
    public boolean deleteById(Integer id) {
        bookDao.deleteById(id);
        return true;
    }
}
